﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tools;

namespace Dominion
{
    public class Game
    {
        public Supply                Supply     {get; protected set;}
        public List<Card>            Trash      {get; protected set;}
        public CircularQueue<Player> Players    {get; protected set;}
        public List<Currency>        Currencies {get; protected set;}

        public Currency GetCurrency(string name) {return Currencies.Find(c => c.Name == name);}

        public Game()
        {
            Currencies = new List<Currency>();
            Players    = new CircularQueue<Player>(3);
            Supply     = new Supply();
            Trash      = new List<Card>();
            Currencies.Add(new Currency(name: "Coin", pluralname: "Coins"));
        }
        private static Game _CurrentGame = null;
        public  static Game Current 
        {
            get 
            {
                if (_CurrentGame == null) _CurrentGame = new Game(); 
                return _CurrentGame;
            } 
            protected set {;}
        }
    }

    public class Matt
    {
        public string       Name                  {get; protected set;}
        public List<Card>   Cards                 {get; protected set;}
        public Dictionary<TokenType, uint> Tokens {get; protected set;}
    }

    public class Currency
    {
        public Currency(string name, string pluralname)
        {
            Name       = name;
            PluralName = pluralname;
        }
        public string Name       {get; protected set;}
        public string PluralName {get; protected set;}
    }
    public class Cost
    {
        public Currency Currency {get; protected set;}
        public int      Amount   {get; protected set;}

        public Cost(string name, int amount)
        {
            Currency = Game.Current.GetCurrency(name);
            Amount   = amount;
        }
    }
}
